<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #d1{
            width: 200px;
            height: 200px;
            background-color: #ff2fb6;
            /*固定定位*/
            position: fixed;
            top: 100px;
            left: 100px;
        }

        #d2{
            width: 100px;
            height: 2000px;
            border: 1px solid green;
        }
    </style>
</head>
<body>

    <div id="d1">div1</div>
    <div id="d2">div2</div>

</body>
</html>